<%= form_for @node do |f| %>
<p>
<!-- SELECT NODE TYPE -->
  <% if @node.nodeType != nil %>
    <%= f.select :nodeType_id, options_from_collection_for_select(NodeType.all, :id, :name, @node.nodeType.id), :include_blank => true %>
  <% else %>
    <%= f.select :nodeType_id, options_from_collection_for_select(NodeType.all, :id, :name), :include_blank => true %>
  <% end %>

  <%= f.text_field :name %> part of

<!-- SELECT PARENT NODE -->  
  <% if @node.parent != nil %>
    <%= f.select :parent_id, options_from_collection_for_select(Node.all, :id, :name, @node.parent.id), :include_blank => true %>
  <% elsif @origin_node != nil %>
    <%= f.select :parent_id, options_from_collection_for_select(Node.all, :id, :name, @origin_node.id), :include_blank => true %>
  <% else %>
    <%= f.select :parent_id, options_from_collection_for_select(Node.all, :id, :name), :include_blank => true %>
  <% end %>
<br/>
<strong>Description:</strong><br/>
<%= f.text_area :description %>
<br/><br/>
<strong>Has Phases:</strong><br>

<em>(Hold CMD Key to select multiple)</em><br/>
<%= collection_select(:phaseType, :id, PhaseType.all, :id, :name, {},{:multiple => true}) %>
<br/>
<br/>

  <%= f.submit %>
  <% if @origin_node != nil %>
    <%= link_to 'Cancel', @origin_node %>
  <% else %>
    <%= link_to 'Cancel', @node %>
  <% end %>
</p>
<% end %>
